package com.example.demo.mapper;

import com.example.demo.bean.Records;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface RecordMapper {
    @Insert("insert into records (record_time) values (#{records.record_time})")
    @Options(useGeneratedKeys = true, keyProperty = "record_id") // 自动获取主键
    void insertRecord(@Param("records") Records records);

    @Select("select count(*) from records")
    int get_max_page();

    @Select("select * from records where record_id >= #{min_id} and record_id <= #{max_id} order by record_id")
    List<Records> get_costs(@Param("min_id") int min_id,@Param("max_id") int max_id);
}
